#vertex --------------------------------
//mapping offset:COLOR2
//mapping position:POSITION

attribute vec3 position;
attribute vec4 offset;
uniform mat4 game_MatrixVP:VP;
uniform mat4 game_MatrixM:M;
uniform vec4 time:TIME;
varying float alpha;
void main(void){
    mat4 modelMat =game_MatrixM;
    vec4 wp=modelMat*vec4(position,1.0);
    wp.xyz+=offset.xyz;
    float r=rand(offset.xz);
    float s=position.y+0.3;
    wp.x+=s*cos(time.x*2.+offset.y)*0.2*r;
    r=rand(offset.zx);
    wp.z+=s*sin(time.y*2.+offset.y)*0.2*r;
    alpha=offset.w;
    gl_Position = game_MatrixVP * wp;
}
#fragment ------------------------------
//mapping gcolor:COLOR
uniform vec4 gcolor;
varying float alpha;
void main(void){
    vec4 baseColor=vec4(0.3,alpha*0.3+0.6,0,1);
    gl_FragColor = baseColor;
}
